package com.jameci.luntan.controller;

import com.jameci.luntan.mapper.PostMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

@Controller
public class DropController {
    @Autowired
    private PostMapper postMapper;
    @GetMapping("/drop")
    public String drop(
            @RequestParam("id") int id
    ) {
        postMapper.deleteByPrimaryKey(id);
        return "redirect:/";
    }
}
